package huang.course.jan21;

import java.sql.SQLException;

public class UserService {
	public boolean login(String username,String pwd) throws SQLException{
		boolean result=false;
		UserDao ud=new UserDao();
		User u=ud.getUserbyName(username);
		if(pwd.equals(u.getPwd())){
			result =true;
		}
		return result;
	}
	public boolean register(String username,String pwd) throws SQLException{
		boolean result=false;
		UserDao ud=new UserDao();
		User u=ud.getUserbyName(username);
		if(u.getPwd()==null){
			ud.risgter(username, pwd);
			result=true;
		}else{
			result=false;
		}
		
		
		
		return result;
	}
}
